package com.xuecheng.system.application.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.xuecheng.system.application.service.DictionaryApplication;
import com.xuecheng.system.application.vo.resp.DictionaryDto;
import com.xuecheng.system.domain.service.DictionaryService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-08-03  17:11
 */
@Service
public class DictionaryApplicationImpl implements DictionaryApplication {

    @Autowired
    private DictionaryService dictionaryService;

    @Override
    public List<DictionaryDto> queryAll() {
        return BeanUtil.copyToList(dictionaryService.queryAll(), DictionaryDto.class);
    }

    @Override
    public DictionaryDto getByCode(String code) {
        return BeanUtil.copyProperties(dictionaryService.getByCode(code), DictionaryDto.class);
    }
}
